package com.lvhx.rocketmq;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

@Service
@RocketMQMessageListener(
    topic = "test-topic",          // 监听的Topic
    consumerGroup = "my-consumer-group",  // 消费者组名
    selectorExpression = "tagA"    // 可选：只消费Tag为tagA的消息
)
@Slf4j
public class MessageConsumer implements RocketMQListener<String> {

    @Override
    public void onMessage(String message) {
        log.info("=====Received message: " + message);
    }
}